package com.service;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Service;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class MQReceiveService {
	/**
	 * 监听消费消息
	 * 
	 * @param message
	 */
	@RabbitListener(queues = "${basic.info.mq.queue.name}")
	public void consumeMessage(@Payload byte[] message) {
		try {
			// TODO：接收String
			String result = new String(message, "UTF-8");
			log.info("接收String消息： {} ", result);
		} catch (Exception e) {
			log.error("监听消费消息 发生异常： ", e.fillInStackTrace());
		}
	}
}
